


#ifndef __GVCP_H__
#define __GVCP_H__



#include "qe_def.h"



/*
 *  GVCP Command and Acknowledge Values
 */
typedef enum {
    /* Discovery Protocol Control */
    GVCP_DISCOVERY_CMD    = 0x0002,
    GVCP_DISCOVERY_ACK    = 0x0003,
    GVCP_FORCEIP_CMD      = 0x0004,
    GVCP_FORCEIP_ACK      = 0x0005,
    /* Streaming Protocol Control */
    GVCP_PACKETRESEND_CMD = 0x0040,
    /* Device Memory Access */
    GVCP_READREG_CMD      = 0x0080,
    GVCP_READREG_ACK      = 0x0081,
    GVCP_WRITEREG_CMD     = 0x0082,
    GVCP_WRITEREG_ACK     = 0x0083,
    GVCP_READMEM_CMD      = 0x0084,
    GVCP_READMEM_ACK      = 0x0085,
    GVCP_WRITEMEM_CMD     = 0x0086,
    GVCP_WRITEMEM_ACK     = 0x0087,
    GVCP_PENDING_ACK      = 0x0089,
    /* Asynchronous Events */
    GVCP_EVENT_CMD        = 0x00C0,
    GVCP_EVENT_ACK        = 0x00C1,
    GVCP_EVENTDATA_CMD    = 0x00C2,
    GVCP_EVENTDATA_ACK    = 0x00C3,
    /* Miscellaneous */
    GVCP_ACTION_CMD       = 0x0100,
    GVCP_ACTION_ACK       = 0x0101,
} gvcp_cmd_ack_e;

/*
 * GVCP Status Codes 
 */
typedef enum {
    GEV_STATUS_SUCCESS                             = 0x0000,
    GEV_STATUS_PACKET_RESEND                       = 0x0100,
    GEV_STATUS_NOT_IMPLEMENTED                     = 0x8001,
    GEV_STATUS_INVALID_PARAMETER                   = 0x8002,
    GEV_STATUS_INVALID_ADDRESS                     = 0x8003,
    GEV_STATUS_WRITE_PROTECT                       = 0x8004,
    GEV_STATUS_BAD_ALIGNMENT                       = 0x8005,
    GEV_STATUS_ACCESS_DENIED                       = 0x8006,
    GEV_STATUS_BUSY                                = 0x8007,
    GEV_STATUS_PACKET_UNAVAILABLE                  = 0x800C,
    GEV_STATUS_DATA_OVERRUN                        = 0x800D,
    GEV_STATUS_INVALID_HEADER                      = 0x800E,
    GEV_STATUS_PACKET_NOT_YET_AVAILABLE            = 0x8010,
    GEV_STATUS_PACKET_AND_PREV_REMOVED_FROM_MEMORY = 0x8011,
    GEV_STATUS_PACKET_REMOVED_FROM_MEMORY          = 0x8012,
    GEV_STATUS_NO_REF_TIME                         = 0x8013,
    GEV_STATUS_PACKET_TEMPORARILY_UNAVAILABLE      = 0x8014,
    GEV_STATUS_OVERFLOW                            = 0x8015,
    GEV_STATUS_ACTION_LATE                         = 0x8016,
    GEV_STATUS_LEADER_TRAILER_OVERFLOW             = 0x8017,
    GEV_STATUS_ERROR                               = 0x8FFF,
} gev_status_e;

/*
 * GVCP Status Codes 
 */
typedef enum {
    GEV_EVENT_PRIMARY_APP_SWITCH = 0x0007,
    GEV_EVENT_LINK_SPEED_CHANGE = 0x0008,
    GEV_EVENT_ACTION_LATE = 0x0009,
    
} gev_event_e;

/*
 * GVCP Command Header
 */
struct gvcp_cmd_hdr {
    qe_u8  key;         /* Hard-coded key code value used for message validation */
    qe_u8  flag;        /* Command message flags */
    qe_u16 command;     /* Command message value */
    qe_u16 length;      /* Number of valid data bytes in this message, not including this header */
    qe_u16 req_id;      /* This field is the request ID generated by the application */
};

/*
 * GVCP Acknowledge Header
 */
struct gvcp_ack_hdr {
    qe_u16 status;      /* Status of the requested operation  */
    qe_u16 ack;         /* Acknowledge message value */
    qe_u16 length;      /* Number of valid data bytes in this message, not including this header */
    qe_u16 ack_id;      /* This field is the acknowledge ID and has the same value as the 
                           corresponding command req_id */
};


struct gvcp_discover_ack {
    struct gvcp_ack_hdr ackhdr;
    qe_u16 spec_version_major;
    qe_u16 spec_version_minor;
    qe_u32 device_mode;
    qe_u16 reserved0;
    qe_u8  device_mac[6];
    qe_u32 ip_config_options;
    qe_u32 ip_config_current;
    qe_u32 reserved1;
    qe_u32 reserved2;
    qe_u32 reserved3;
    qe_u32 current_ip;
    qe_u32 reserved4;
    qe_u32 reserved5;
    qe_u32 reserved6;
    qe_u32 current_subnet_mask;
    qe_u32 reserved7;
    qe_u32 reserved8;
    qe_u32 reserved9;
    qe_u32 default_gateway;
    char   manufacturer[32];
    char   model[32];
    char   device_version[32];
    char   manufacturer_spec_info[48];
    char   serial_number[16];
    char   user_defined_name[16];
};
#endif /* __GVCP_H__ */